#define _CRT_SECURE_NO_WARNINGS 1
#define MAX 10
#include <stdbool.h>
#include <stdio.h>

bool up_jugde(int* number, int len)
{
    int* left = number;
    int* right = number + len - 1;
    int* mid = left + (right-left) / 2;
    while (*mid > *left && *mid < *right && len >= 2)
    {
        return up_jugde(mid, len / 2);
    }
    if (len == 1 || len == 2)
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool down_jugde(int* number, int len)
{
    int* left = number;
    int* right = number + len - 1;
    int* mid = left + (right - left) / 2;
    while (*mid<*left && *mid>*right && len >= 2)
    {
        return down_jugde(mid, len / 2);
    }
    if (len == 1 || len == 2)
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool equal_jugde(int* number, int len)
{
    int* left = number;
    int* right = number + len - 1;
    int* mid = left + (right - left) / 2;
    while (*mid == *left && *mid == *right && len >= 2)
    {
        return equal_jugde(mid, len / 2);
    }
    if (len == 1 || len == 2)
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool jugde(int* number, int len)
{
    int* left = number;
    int* right = number + len - 1;
    if (*left < *right)
    {
        return up_jugde(number, len);
    }
    else if (*left > *right)
    {
        return down_jugde(number, len);
    }
    else
    {
        return equal_jugde(number, len);
    }
}

int main() {
    int n = 0;
    scanf("%d", &n);
    int number[MAX] = { 0 };
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &number[i]);
    }
    bool flag = jugde(number, n);
    if (flag)
    {
        printf("sorted");
    }
    else
    {
        printf("unsorted");
    }
    return 0;
}